package com.fenxiangle.yueding.feature.order.view.adapter;

import android.text.TextUtils;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.fenxiangle.yueding.R;
import com.fenxiangle.yueding.common.widget.RatingBar;
import com.fenxiangle.yueding.entity.bo.TeamBo;
import com.suozhang.framework.framework.AM;

import java.util.List;

/**
 * @ProjectName: YueDing
 * @Package: com.fenxiangle.yueding.feature.order.view.adapter
 * @ClassName: ContactDetailAdapter
 * @Description: java类作用描述
 * @Author:
 * @CreateDate: 2019/3/8 18:11
 * @UpdateUser: 更新者
 * @UpdateDate: 2019/3/8 18:11
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class CommentAdapter extends BaseQuickAdapter<TeamBo, BaseViewHolder> {
    private List<TeamBo> teamBos;

    public CommentAdapter() {
        super(R.layout.item_comment_detail);
    }

    public CommentAdapter(List<TeamBo> teamBos) {
        super(R.layout.item_comment_detail, teamBos);
        this.teamBos = teamBos;
    }

    //	-1=已失效,0=待抢单,1=已抢单,2=已选定,3=交易中,4=待确认,5=待评价,6=申诉中，7=已完成
    @Override
    protected void convert(BaseViewHolder helper, TeamBo item) {
        helper.setText(R.id.tv_level_name, item.getUserName())
                .setText(R.id.tv_level_id, "信用分:" + item.getCreditScore())
                .addOnClickListener(R.id.iv_level_head);
        AM.image().bindToCircleObject(item.getUserHead(), helper.getView(R.id.iv_level_head));

        RatingBar ratingBar = helper.getView(R.id.rb_order_comment_star);
        ratingBar.setOnRatingChangeListener(new RatingBar.OnRatingChangeListener() {
            @Override
            public void onRatingChange(float ratingCount) {
                TeamBo teamBo = teamBos.get(helper.getAdapterPosition());
                teamBo.setScore((int) ratingCount);
                teamBos.set(helper.getAdapterPosition(), teamBo);
            }
        });
    }

    public void setTeamBos(List<TeamBo> teamBos){
        this.teamBos=teamBos;
    }
}
